<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name=viewport content="with=device-width,initial-scale=1.0">
<link href="../resource/bootstrap/css/bootstrap.min.css"
	rel="stylesheet">
<link href="../resource/css/basic.css" rel="stylesheet">
<script src="../resource/js/jquery.min.js"></script>
<script src="../resource/bootstrap/js/bootstrap.min.js"></script>
<script src="../resource/js/user.js"></script>
<script>
	$(function() {
		$('#loginout').click(logout);
		$('#oneType a[data-type=deal]:gt(0)').click(getMajorList);
		$('#oneType a[data-toggle=modal]').click(
				function(event) {
					var $btnCommit = $(this);
					var $typeName = $btnCommit.parent().prev()
					$('#typeUpdate')
							.attr('data-id', $btnCommit.attr('data-id')).attr(
									'data-type', 'oneType');
					$('#myModal input[name=type]').val($typeName.text());
				});
		$('#twoType a[data-toggle=modal]').click(
				function(event) {
					var $btnCommit = $(this);
					var $typeName = $btnCommit.parent().prev()
					$('#typeUpdate')
							.attr('data-id', $btnCommit.attr('data-id')).attr(
									'data-type', 'twoType');
					$('#myModal input[name=type]').val($typeName.text());
				});
		$('#oneType a[data-type=delete],#twoType a[data-type=delete]').click(deleteDepartmentAndMajor);
		$('#typeUpdate').click(updateDepartmentAndMajor);
	});
</script>
<title>学生专业管理</title>
</head>
<body>
	<nav class="navbar navbar-primary navbar-fixed-top" role="invigation">
		<div class="navbar-header">
			<img class="img-responsive" src="../resource/image/header3.png" />
		</div>
		<ul class="user nav navbar-nav navbar-right">
			<li><a href="#">欢迎您，${admin.petName }</a></li>
			<li><a id="loginout" href="#" data-roles="admin"><i class="glyphicon glyphicon-off"></i> 退出登录
			</a></li>
		</ul>
	</nav>
	<div>
		<nav class="col-md-2">
			<div class="row panel panel-default">
				<div class="panel-body">
					<div class="list-group">
						<a class="list-group-item" href="../admin">首页导航</a>
					</div>
					<div class="list-group">
						<a class="list-group-item active" href="studentMajor">专业管理<span
							class="badge">2</span></a> <a class="list-group-item"
							href="publishDepartment">系别添加</a> <a class="list-group-item"
							href="publishMajor">专业添加</a>
					</div>
					<div class="list-group">
						<a class="list-group-item" href="lessonType">课程类别<span
							class="badge">2</span></a> <a class="list-group-item"
							href="publishOneType">课程一级类添加</a> <a class="list-group-item"
							href="publishTwoType">课程二级类添加</a>
					</div>
					<div class="list-group">
						<a class="list-group-item" href="userRoles">角色权限管理</a>
					</div>
					<div class="list-group">
						<a class="list-group-item" href="#">公告发布</a>
					</div>
					<div class="list-group">
						<a class="list-group-item" href="#">系统信息<span class="badge">1</span></a>
						<a class="list-group-item" href="#">异常信息</a>
					</div>
					<div class="list-group">
						<a class="list-group-item" href="systemInfo">性能监测</a>
					</div>
				</div>
			</div>
		</nav>
		<div class="col-md-10">
			<div class="row panel panel-default">
				<div class="panel-heading">
					<ol class="breadcrumb">
						<li><a href="../admin"><i
								class="glyphicon glyphicon-home"></i> 首页</a></li>
						<li class="active">学生专业管理</li>
					</ol>
				</div>
				<div class="panel-body">
					<div class="col-sm-6">
						<div class="panel panel-default">
							<div class="panel-body">
								<table id="oneType"
									class="table table-striped table-bordered table-hover">
									<tr>
										<th>ID</th>
										<th>系别</th>
										<th>操作</th>
									</tr>
									<c:forEach items="${department }" var="lot">
										<tr>
											<td>${lot.id }</td>
											<td id="oneTypeName${lot.id }">${lot.name }</td>
											<td><a href="#type${lot.id }"
												class="btn btn-primary btn-xs" data-id="${lot.id}"
												data-type="deal" data-toggle="tab">管理</a> <a href="#"
												class="btn btn-success btn-xs" data-id="${lot.id}"
												data-toggle="modal" data-target="#myModal">修改</a> <a
												href="#" class="btn btn-danger btn-xs" data-type="delete"
												data-parent="oneType" data-id="${lot.id}">删除</a></td>
										</tr>
									</c:forEach>
								</table>
							</div>
						</div>
					</div>
					<div class="col-sm-6">
						<div class="panel panel-default">
							<div id="twoType" class="panel-body tab-content">
								<div id="type${department[0].id }"
									class="tab-pane fade active in">
									<table class="table table-striped table-bordered table-hover">
										<tr>
											<th>ID</th>
											<th>专业</th>
											<th>操作</th>
										</tr>
										<c:forEach items="${major }" var="ltt">
											<tr>
												<td>${ltt.id }</td>
												<td id="twoTypeName${ltt.id }">${ltt.majorName }</td>
												<td><a href="#" class="btn btn-success btn-xs"
													data-id="${ltt.id}" data-toggle="modal"
													data-target="#myModal">修改</a> <a href="#"
													class="btn btn-danger btn-xs" data-type="delete"
													data-parent="twoType" data-id="${ltt.id}">删除</a></td>
											</tr>
										</c:forEach>
									</table>
								</div>
							</div>
						</div>
					</div>
					<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
						aria-labelledby="myModalLabel" aria-hidden="true">
						<div class="modal-dialog">
							<div class="modal-content">
								<div class="modal-header">
									<button type="button" class="close" data-dismiss="modal"
										aria-hidden="true">&times;</button>
									<h4 class="modal-title">更新</h4>
								</div>
								<div class="modal-body">
									<div class="form-group">
										<label class="col-sm-3 control-lable text-right">专业/系别：</label>
										<div class="col-sm-9">
											<input class="form-control" name="type" type="text" />
										</div>
									</div>
									<br />
								</div>
								<div class="modal-footer">
									<button type="button" class="btn btn-default"
										data-dismiss="modal">取消</button>
									<button id="typeUpdate" type="button" class="btn btn-primary">提交</button>
								</div>
							</div>
							<!-- /.modal-content -->
						</div>
						<!-- /.modal-dialog -->
					</div>
					<!-- /.modal -->

				</div>
			</div>
		</div>
	</div>
</body>
</html>